package cn.edu.neu.vmmigeval.cloud.policy.impl;


import cn.edu.neu.vmmigeval.cloud.entity.Host;
import cn.edu.neu.vmmigeval.cloud.policy.MigratedHostPolicy;

public class MigratedHostPolicyDoubleThreshold extends MigratedHostPolicy {
	
	private double highThreshold =0.9;
	private double lowThreshold = 0.2;
	
	/*public MigratedHostPolicyDefault(List<Host> hostList,double threshold){
		super(hostList);
		this.threshold = threshold;
	}*/
	public MigratedHostPolicyDoubleThreshold(){
		
	}
	
	public MigratedHostPolicyDoubleThreshold(double threshold) {
		super();
		this.highThreshold = threshold;
	}

	@Override
	public boolean isHostOverUtilized(Host host) {
		
		double cpuUtilization=0.0;
		if(host.getActive()==0&&!host.isMigration()){
			cpuUtilization = (double)host.getCurrentCpu()/host.getTotalCpu();
			if(cpuUtilization>=highThreshold){
				return true;
			}
		}
		return false;
	}

	@Override
	public boolean isHostUnderUtilized(Host host) {
		// TODO Auto-generated method stub
		return false;
	}
	
	

}
